Skip to contentSkip to conversation

Change in openvpn[master]: redirect-gateway: Only redirect traffic through TUN if address famili...

Openvpn-devel In review mrbff (Code Review) 2 participants 16 messages Sep 24, 2025 – Oct 11, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1758706218000.Ib3458a9ed2eb38e00184c4a92659b83b97fe476c@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email

to review the following change.

Change subject: redirect-gateway: Only redirect traffic through TUN if address families match
......................................................................

redirect-gateway: Only redirect traffic through TUN if address families match

Fixes an ifconfig push-reply bug where, if the remote is switched and the new TUN has a different address family, the previous ifconfig options remain assigned to the new TUN.

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
---
M src/openvpn/init.c
M src/openvpn/options.c

2 files changed, 6 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/1

src/openvpn/init.c +1 -1
index 0d7a2ec..a5be243 100644
@@ -1518,7 +1518,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;
src/openvpn/options.c +5 -0
index 151a016..5972cb9 100644
@@ -5464,6 +5464,11 @@
     const msglvl_t msglevel = D_PUSH_ERRORS | M_OPTERR;
     unsigned int update_options_found = 0;
 
+    options->ifconfig_local = NULL;
+    options->ifconfig_remote_netmask = NULL;
+    options->ifconfig_ipv6_local = NULL;
+    options->ifconfig_ipv6_netbits = 0;
+    options->ifconfig_ipv6_remote = NULL;
     while (buf_parse(buf, ',', line, sizeof(line)))
     {
         char *p[MAX_PARMS + 1];

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: Only redirect traffic through TUN if address families match
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
Is this about push-reply, as the commit message says, or about PUSH_UPDATE, as the code suggests?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Wed, 24 Sep 2025 09:55:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: Only redirect traffic through TUN if address families match
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:

Quoted 1 line

Is this about push-reply, as the commit message says, or about PUSH_UPDATE, as the code suggests […]

No push-reply is correct, but actually is for push-update too. The bug can be triggered just adding a sequence of remote-ipv4 and remote-ipv6, so if server disconnect, the connection is switched to the next remote and if the family is not the same it can creates some problems.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 24 Sep 2025 10:10:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: Only redirect traffic through TUN if address families match
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:

Quoted 1 line

No push-reply is correct, but actually is for push-update too. […]

Can you link to an issue having a full log showing what happens and why this is a problem? I need to test this before merging, so need to know what to look for.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Wed, 24 Sep 2025 10:11:40 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>
Gerrit-MessageType: comment

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: Only redirect traffic through TUN if address families match
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:

Quoted 1 line

Can you link to an issue having a full log showing what happens and why this is a problem? I need t […]

https://github.com/OpenVPN/openvpn/issues/850
Issue opened, hope it's clear enough. Anyway you can just watch the test logs provided in the issue. If you want to easily test by yourself i also provided some scripts i used.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 25 Sep 2025 13:07:24 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email

to look at the new patch set (#2).

Change subject: redirect-gateway: Only redirect traffic through TUN if address families match
......................................................................

redirect-gateway: Only redirect traffic through TUN if address families match

Fixes an ifconfig push-reply bug where, if the remote is switched and the new TUN has a different address family, the previous ifconfig options remain assigned to the new TUN.

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
---
M src/openvpn/init.c
M src/openvpn/options.c

2 files changed, 13 insertions(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/2

src/openvpn/init.c +1 -1
index f8a0fee..aaa0573 100644
@@ -1523,7 +1523,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;
src/openvpn/options.c +12 -0
index f35738d..185233f 100644
@@ -5470,6 +5470,18 @@
     const msglvl_t msglevel = D_PUSH_ERRORS | M_OPTERR;
     unsigned int update_options_found = 0;
 
+    /* When receiving a PUSH_REPLY, reset the ifconfig options to prevent
+     * stale data conflicts. This could be necessary when the new address has a
+     * different address family than the previous one. */
+    if (!is_update)
+    {
+        options->ifconfig_local = NULL;
+        options->ifconfig_remote_netmask = NULL;
+        options->ifconfig_ipv6_local = NULL;
+        options->ifconfig_ipv6_netbits = 0;
+        options->ifconfig_ipv6_remote = NULL;
+    }
+
     while (buf_parse(buf, ',', line, sizeof(line)))
     {
         char *p[MAX_PARMS + 1];

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 2
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>

#7 lore raw

[Openvpn-devel] [M] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email

to look at the new patch set (#3).

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

redirect-gateway: only redirect traffic through TUN if address families match

Fixes an ifconfig push-reply bug where, if the remote is switched and the new TUN has a different address family, the previous ifconfig options remain assigned to the new TUN.

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

It also resets the ifconfig and ifconfig-ipv6 options on every PUSH_REPLY and whenever a valid ifconfig or ifconfig-ipv6 option is found in a PUSH_UPDATE message to avoid stale data conflicts. This may be necessary when the new address has a different address family than the old one.

Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
---
M src/openvpn/init.c
M src/openvpn/options.c

2 files changed, 62 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/3

src/openvpn/init.c +1 -1
index f8a0fee..aaa0573 100644
@@ -1523,7 +1523,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;
src/openvpn/options.c +61 -1

80 lines not on this page · raw message

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 3
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: cron2 <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>

#8 lore raw

[Openvpn-devel] [M] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

Patch Set 3: Code-Review-2

(1 comment)

Patchset:

PS3:
This looks like it's not actually the correct way to do it - with the patch, a client that has a local --ifconfig configured will lose that on PUSH_REPLY, no matter what the server pushes. This is a valid use case and must not be broken.

We do have the concept of "saved config data" which preserves what is in the client config - so ifconfig and ifconfig-ipv6 need to be reset to "what is in the client config" before connecting out (PUSH_REPLY), otherwise we will break existing setups.

For PUSH_REPLY I do not really care, as that's new functionality.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 3
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Mon, 06 Oct 2025 09:15:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#9 lore raw

[Openvpn-devel] [M] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

Patch Set 3:

(1 comment)

Patchset:

PS1:

Quoted 1 line

https://github.com/OpenVPN/openvpn/issues/850 […]

please do also link to the issue in the commit message (Github: fixes OpenVPN/openvpn#850)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 3
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Mon, 06 Oct 2025 09:17:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>

#10 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

Hello cron2, flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email

to look at the new patch set (#4).

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

redirect-gateway: only redirect traffic through TUN if address families match

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

Github: fixes OpenVPN/openvpn#850
github.com/OpenVPN/openvpn/issues/850

Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
---
M src/openvpn/init.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/4

src/openvpn/init.c +1 -1
index f8a0fee..aaa0573 100644
@@ -1523,7 +1523,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 4
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>

#11 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

mrbff has posted comments on this change by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

Patch Set 4:

(1 comment)

Patchset:

PS1:

Quoted 1 line

please do also link to the issue in the commit message (Github: fixes OpenVPN/openvpn#850)

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 4
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Fri, 10 Oct 2025 15:50:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>

#12 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

Attention is currently required from: flichtenheld, mrbff, plaisthos.

cron2 has posted comments on this change by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

Patch Set 4: Code-Review+2

(1 comment)

Patchset:

PS4:
This has become nicely small :-)

I still think it's not the fully correct fix (if we have a "stale" redirect-gateway ipv6, we should fix that at config saving/restoral, and not just ignore it later on). But for beta3, we can move ahead, and in the new GH issue we can then revert it if we conclude that we want to.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 4
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Sat, 11 Oct 2025 11:12:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes

#13 lore raw

PATCH v4 1/1 redirect-gateway: only redirect traffic through TUN if address families match

In reply to a message not in the archive

From: Marco Baffo <[email protected]...>

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

Github: fixes OpenVPN/openvpn#850
github.com/OpenVPN/openvpn/issues/850

Change-Id Ib3458a9ed2eb38e00184c4a92659b83b97fe476c

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
This mail reflects revision 4 of this Change.

Signed-off-by line for the author was added as per our policy.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/init.c +1 -1
index f8a0fee..aaa0573 100644
@@ -1523,7 +1523,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;
#14 lore raw

[Openvpn-devel] [PATCH applied] Re: redirect-gateway: only redirect traffic through TUN if address families match

So, this is still fixing an edge case when reconnecting and having stale data around - a better fix, I think, would be to properly extend pre-connect save/restore to the RG flags (and remove this check again)
- but for now, it does the job. I have added a reference to the new GH issue (863) for the subsequent cleanup.

Not tested beyond "BB confirms it's not breaking platforms" and a bit of stare-at-code.

Your patch has been applied to the master branch.

commit 1b423f508e7ebf70e711c90bc9cf2e57c1f197f0

Author: Marco Baffo
Date:   Sat Oct 11 13:14:11 2025 +0200
     redirect-gateway: only redirect traffic through TUN if address families match

     Signed-off-by: mrbff <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59245295/
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#15 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

cron2 has uploaded a new patch set (#5) to the change originally created by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

redirect-gateway: only redirect traffic through TUN if address families match

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

Github: fixes OpenVPN/openvpn#850
Github: see also OpenVPN/openvpn#863

Change-Id Ib3458a9ed2eb38e00184c4a92659b83b97fe476c

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245295/

---
M src/openvpn/init.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/10/1210/5

src/openvpn/init.c +1 -1
index f8a0fee..aaa0573 100644
@@ -1523,7 +1523,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 5
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#16 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: redirect-gateway: only redirect traffic through TUN if address famili...

In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email )

Change subject: redirect-gateway: only redirect traffic through TUN if address families match
......................................................................

redirect-gateway: only redirect traffic through TUN if address families match

Adds a check in do_init_route_ipv6_list() to add default routes toward the TUN only if the TUN has IPv6 addresses.

Github: fixes OpenVPN/openvpn#850
Github: see also OpenVPN/openvpn#863

Change-Id Ib3458a9ed2eb38e00184c4a92659b83b97fe476c

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1210
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59245295/

---
M src/openvpn/init.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/init.c +1 -1
index f8a0fee..aaa0573 100644
@@ -1523,7 +1523,7 @@
 
     /* redirect (IPv6) gateway to VPN?  if yes, add a few more specifics
      */
-    if (options->routes_ipv6->flags & RG_REROUTE_GW)
+    if (options->routes_ipv6->flags & RG_REROUTE_GW && options->ifconfig_ipv6_local)
     {
         char *opt_list[] = { "::/3", "2000::/4", "3000::/4", "fc00::/7", NULL };
         int i;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1210?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ib3458a9ed2eb38e00184c4a92659b83b97fe476c
Gerrit-Change-Number: 1210
Gerrit-PatchSet: 5
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>